<script setup lang="ts">
import {ref} from "vue";
import {GlobalInfo} from "../GlobalInfo"

const username=ref("");
const pwd=ref("");

const loginClick = async ()=>{
    try
    {
        await GlobalInfo.login(username.value,pwd.value);
        GlobalInfo.isEditing.value = true;
    }
    catch(e){
        GlobalInfo.showError(e);
    }
}
</script>
<template>
    <div>
        <div><input placeholder="username" v-model="username"></div>
        <div><input placeholder="password" type="password" v-model="pwd"></div>
        <div>
            <button @click="loginClick"> Login </button>
        </div>
    </div>
</template>
<style scoped>
</style>